//
//  WJY_HotCollectionCell.m
//  MooMusic
//
//  Created by wjy on 15/10/21.
//  Copyright © 2015年 wjy. All rights reserved.
//

#import "WJY_HotCollectionCell.h"

@implementation WJY_HotCollectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
//        self.myView = [[UIView alloc] init];
//        [self.contentView addSubview:self.myView];
        self.imgV = [[UIImageView alloc] init];
//        self.imgV.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_imgV];
        self.label = [[UILabel alloc] init];
//        self.label.backgroundColor = [UIColor colorWithRed:0.927 green:0.966 blue:0.980 alpha:1.000];
        self.label.numberOfLines = 0;
        self.label.font = [UIFont systemFontOfSize:13];
//        self.label.numberOfLines = 0;
//        self.label.textAlignment = NSTextAlignmentCenter;
//        self.label.layer.cornerRadius = 5;
//        self.label.clipsToBounds = YES;
        [self.contentView addSubview:self.label];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.imgV.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height - 30);
    //    self.imgV.frame = CGRectMake(self.myView.frame.origin.x, self.myView.frame.origin.y, self.myView.frame.size.width, self.myView.frame.size.height - 15);
        self.label.frame = CGRectMake(self.imgV.frame.origin.x, self.imgV.frame.size.height , self.imgV.frame.size.width, 35);
}
- (void)setModel:(HomeModel *)model
{
    if (_model != model) {
        _model = model;
    }
    [self.imgV sd_setImageWithURL:[NSURL URLWithString:model.picUrl] placeholderImage:[UIImage imageNamed:@"mv_big_cover_default.jpg"]];
    self.label.text = model.name;
}
@end
